<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>请命名~</title>
	</head>
	<body>
		<script>
			// // 父类型
			// function Supper(){
			// 	this.supProp = "supper prototype"
			// }
			// Supper.prototype.showSupperProp = function(){
			// 	console.log(this.supProp);
			// }
			
			// // 子类型
			// function Sub(){
			// 	this.subProp = "subProp prototype"
			// }
			// // 子类型的原型为父类型的一个实例对象
			// Sub.prototype = new Supper();
			// Sub.prototype.constructor = Sub;
			// Sub.prototype.showSubProp =function (){
			// 	console.log(this.subProp);
			// }
			// var sub = new Sub();
			// sub.showSupperProp();
			// sub.showSubProp();
			
			// --------------------------------------------
			// function Person(name, age){
			// 	this.name = name;
			// 	this.age = age;
			// }
			// function Student(name, age, price){
			// 	Person.call(this, name, age);
			// 	this.price = price;
			// }
			// var s1=new Student('通', 23, 442);
			// console.log(s1)
			
			----------------------
			function Person(name, age){
				this.name = name;
				this.age = age;
			}
			Person.prototype.setName = function(name){
				this.name = name;
			}
			function Student(name, age, price){
				Person.call(this, name, age);
				this.price = price;
			}
			Student.prototype = new Person();
			Student.prototype.constructor = Student;
			Student.prototype.setPrice = function(price){
				this.price = price;
			}
			var s1=new Student('通', 23, 442);
			console.log(s1)
		</script>
	</body>
</html>
